//
//  ChuwuCell.m
//  HomeIn
//
//  Created by dllo on 15/11/9.
//  Copyright © 2015年 ZZP. All rights reserved.
//

#import "ChuwuCell.h"
#import "ChuwuModel.h"

@implementation ChuwuCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self creataSubviews];
    }
    return  self;
}

-(void)creataSubviews
{
    self.imageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    [self.contentView addSubview:self.imageView];
    
    //阴影
    UIView *shadowView = [[UIView alloc] initWithFrame:self.contentView.bounds];
    shadowView.backgroundColor = [UIColor blackColor];
    shadowView.alpha = 0.3;
    [self.imageView addSubview:shadowView];
    
    //标题
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.imageView.frame.size.height / 4, self.imageView.frame.size.width, self.imageView.frame.size.height / 4)];
    [self.imageView addSubview:self.titleLabel];
    
    //副标题
    self.subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.titleLabel.frame.origin.y + self.titleLabel.frame.size.height, self.imageView.frame.size.width, self.titleLabel.frame.size.height)];
    [self.imageView addSubview:self.subtitleLabel];

}

- (void)setChuwuModel:(ChuwuModel *)chuwuModel
{
    _chuwuModel = chuwuModel;
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:_chuwuModel.cover_image_url]];
    
    self.titleLabel.text = _chuwuModel.short_title;
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    
    self.subtitleLabel.text = _chuwuModel.title;
    self.subtitleLabel.textColor = [UIColor whiteColor];
    self.subtitleLabel.textAlignment = NSTextAlignmentCenter;
    self.subtitleLabel.font = [UIFont systemFontOfSize:17];
    self.subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
    self.subtitleLabel.numberOfLines = 0;
    
}




@end
